import * as VueRouter from 'vue-router';
import Home from '../views/Home.vue'
import Login from '../views/Login.vue'
import User from '../views/User.vue'
import Publish from '../views/Publish.vue'

const routes = [{
    path: '/',
    name: 'home',
    component: Home
  },
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '/user',
    name: 'user',
    component: User
  },
  {
    path: '/publish/:id?',
    name: 'publish',
    component: Publish
  }
]

const router = VueRouter.createRouter({
  // 4. 内部提供了 history 模式的实现。为了简单起见，我们在这里使用 hash 模式。Publish
  history: VueRouter.createWebHashHistory('user'),
  routes, // `routes: routes` 的缩写
})

export default router
